<?php
class Student {//封装
	var $name;
	var $age;
	var $sex;
	static $school="天津大学";
	function Student($name,$age,$sex){
		$this->name=$name;
		$this->age=$age;
		$this->sex=$sex;
	}
	function say() {
		echo "姓名:".$this -> name."<br/>", "年龄:".$this -> age."<br/>","性别:".$this -> sex."<br/>",self::$school;
	}
	function __get($n){
		echo "当前",$n,"不存在";
	}
	function __set($key,$val){
		$this->$key=$val;
		echo $this->$key;
	}
	 function __destruct() {//析构函数
        echo "当对象销毁时会调用！！！";
   }
	

}
//张三
//$zhangsan=new Student();
//$zhangsan->name="张三";
//$zhangsan->age=20;
//$zhangsan->sex="男";
//var_dump($zhangsan);
//$zhangsan->say();
////李四
//$lisi=new Student();
//$lisi->name="李四";
//$lisi->age=18;
//$lisi->sex="女 ";
//var_dump($lisi);
//$lisi->say();
//
//$lisi->address="111";//走的__set
//echo $lisi->phone;//走的__get

$zhaliu=new Student("赵六",21,"男");
$zhaliu->say();
echo Student::$school;
?>